<?php
include_once 'utiles.php';
?>

<script type="text/javascript">
function ShowSelectedRows(form, tipo){
    var rows = getSelRows();

		if (rows == "") 
		{ 
			alert("Favor seleccione al menos una OT"); 
			return;
		} 


    // Create a new element input 
    var p = document.createElement("input");
    var t = document.createElement("input");
 
    // Add the new element to our form. 
    form.appendChild(p);
    p.name = "ots";
    p.type = "hidden";
    p.value = rows;
    
      // Add the new element to our form. 
    form.appendChild(t);
    t.name = "tipoR";
    t.type = "hidden";
    t.value = tipo;  
 
    // Make sure the plaintext password doesn't get sent. 
    rows.value = "";
 		tipo.value = "";
 		
    // Finally submit the form. 
    form.submit();

    // replace your own javascript here
    //alert(rows);
}
</script>

<?php
if(login_check() == true) {
	require_once("datagrid.php");

	$ordenesTrabajoDG = ordenesTrabajoDG("CRU",true);

	$ordenesTrabajoDG->display();
} else {
	header('Location: login.php?error=2');
}	
?>
<form class="form-signin" role="form" action="rendicionVereda.php" method="post" name="rendicionVereda">
<div class="btn-group">
  <button type="button" class="btn btn-default"  onclick="ShowSelectedRows(this.form, 'V')">Rendicion Vereda</button>
  <button type="button" class="btn btn-default"  onclick="ShowSelectedRows(this.form, 'F')">Rendicion Fuga</button>
  <button type="button" class="btn btn-default"  onclick="ShowSelectedRows(this.form, 'A')">Rendicion Ambos</button>
 </div>
</form>
